﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Tradex.Connectivity {
    
    /// <summary>
    /// A ConnectionInfo contains all the information about a connection to a specific external system.
    /// </summary>
    [Serializable ()]
    public sealed class ConnectionInfo {

        /// <summary>
        /// Constructor taking all arguments.
        /// </summary>
        /// <param name="connector"></param>
        /// <param name="hostType"></param>
        /// <param name="parameters"></param>
        /// <param name="feedKey"></param>
        /// <param name="dumpFolderPath"></param>
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1026:DefaultParametersShouldNotBeUsed")]
        public ConnectionInfo(
            string connector,
            ConnectionHostType hostType,
            string parameters,
            FeedKey feedKey,
            string dumpFolderPath = null
        ) {
            Timestamp = DateTime.UtcNow;
            Connector = connector;
            HostType = hostType;
            Parameters = parameters;
            FeedKey = feedKey;
            DumpFolderPath = dumpFolderPath;
        }

        /// <summary>
        /// Constructor taking all arguments.
        /// </summary>
        /// <param name="timestamp"></param>
        /// <param name="connector"></param>
        /// <param name="wrapper"></param>
        /// <param name="parameters"></param>
        /// <param name="feedKey"></param>
        /// <param name="dumpFolderPath"></param>
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1026:DefaultParametersShouldNotBeUsed")]
        public ConnectionInfo(
            DateTime timestamp,
            string connector,
            ConnectionHostType wrapper,
            string parameters,
            FeedKey feedKey,
            string dumpFolderPath = null
        ) {
            Timestamp = timestamp;
            Connector = connector;
            HostType = wrapper;
            Parameters = parameters;
            FeedKey = feedKey;
            DumpFolderPath = dumpFolderPath;
        }

        /// <summary>
        /// The Timestamp of the Info.
        /// </summary>
        public DateTime Timestamp { get; private set; }

        /// <summary>
        /// The connector to use, identified by it's configured code name.
        /// </summary>
        public string Connector { get; private set; }

        /// <summary>
        /// The Wrapper to use to host the connector.
        /// </summary>
        public ConnectionHostType HostType { get; private set; }

        /// <summary>
        /// The parameter string for the connector.
        /// </summary>
        public string Parameters { get; private set; }

        /// <summary>
        /// The FeedKey to use for the connector.
        /// </summary>
        public FeedKey FeedKey { get; private set; }

        /// <summary>
        /// Gets the path of the data dump folder.
        /// </summary>
        public string DumpFolderPath { get; private set; }

    }

}
